package com;

import com.github.jave.process.KillProcess;

import java.io.IOException;
import java.io.InputStream;

public class Foo {

    public static void main(String[] args) throws IOException, InterruptedException {
        Runtime runtime = Runtime.getRuntime();
        Process process = runtime.exec("ping www.baidu.com");
        runtime.addShutdownHook(new KillProcess(process));

        //System.out.println(process.exitValue());
        //process.waitFor();


        InputStream inputStream = process.getInputStream();
        byte[] read = new byte[10];
        while (inputStream.read(read) != -1){
            String str = new String(read);
            System.out.println(str);
        }




    }
}
